package final_project;

public class Cpc extends Classification {
    private char position;
    private char value;

    public Cpc(char section, int mainClass, char subclass, int mainGroup, int subgroup, char position, char value) {
        super(section, mainClass, subclass, mainGroup, subgroup);

        this.position = position;
        this.value = value;
    }

    public Cpc(String symbol, char position, char value) {
        super(symbol);
        this.position = position;
        this.value = value;
    }

    public char getPosition() {
        return position;
    }

    public void setPosition(char position) {
        this.position = position;
    }

    public char getValue() {
        return value;
    }

    public void setValue(char value) {
        this.value = value;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();

        result = prime * result + position;
        result = prime * result + value;

        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (!super.equals(obj)) {
            return false;
        }

        if (getClass() != obj.getClass()) {
            return false;
        }

        Cpc other = (Cpc) obj;
        if (position != other.position || value != other.value) {
            return false;
        }

        return true;
    }
}
